import request from '../utils/request'

//车辆保单列表
export const wbAllList = () => {
    return request({
        url: "/WB_list",
        method: "GET"
    })
}
//分页查询
export const wbList = (page = 1, limit = 10) => {
    return request({
        url: "/WB_list?_page=" + page + "&_limit=" + limit,
        method: "GET"
    })
}
//修改内容
export const changewb = (obj) => {
    return request({
        url: "/WB_list/" + obj.id,
        method: "PATCH",
        data: {
            wb_date: obj.wb_date,
            wb_reason: obj.wb_reason,
            wb_type: obj.wb_type,
            car_number: obj.car_number,
        }
    })
}
//增加
export const addwb = (obj) => {
    return request({
        url: "/WB_list",
        method: "POST",
        data: {
            wb_id: obj.wb_id,
            wb_date: obj.wb_date,
            wb_reason: obj.wb_reason,
            wb_type: obj.wb_type,
            car_number: obj.car_number,
        }
    })
}
//删除
export const delwb = (obj) => {
    return request({
        url: "/WB_list/" + obj.id,
        method: "DELETE",
    })
}
//查询车辆
export const getwb = (car_number) => {
    return request({
        url: "/WB_list?car_number=" + car_number,
        method: "GET"
    })
}



//后端
//分页查询
export const javawblist = (count = 1, limitNum = 10) => {
    return request({
        url: "/api/message",
        method: "GET",
        params: {
            count, limitNum
        }

    })
}
//添加
export const javaaddwb = (obj) => {
    return request({
        url: "/api/newdata",
        method: "POST",
        data: {
            wbDate: obj.wbDate,
            wbReason: obj.wbReason,
            wbType: obj.wbType,
            carNumber: obj.carNumber,
        }
    })
}
// 删除 /api/deldata/wbId
export const javadelwb = (obj) => {
    return request({
        url: "/api/deldata/?wbId=" + obj.wbId,
        method: "DELETE",
    })
}
//编辑
export const javachangewb = (obj) => {
    return request({
        url: "/api/apply",
        method: "PUT",
        data: {
            id: obj.id,
            wbId: obj.wbId,
            wbDate: obj.wbDate,
            wbReason: obj.wbReason,
            wbType: obj.wbType,
            carNumber: obj.carNumber,
        }
    })
}
//查看单条
export const javagetwb = (obj) => {
    return request({
        url: "/api/onedata",
        method: "GET",
        params: {
            wbId: obj.wbId,
        }
    })
}